package com.ruoyi.bizsys.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
/**
 * 账目流水对象 account_flow_userId % 10
 * @author wqg
 * @date 2022-05-06
 */
@Data
public class AccountFlow{
    private static final long serialVersionUID = 1L;
    /**表后缀**/
    @TableField(exist = false)
    private int tableIndex;
    /**between and 查询的左边，防止索引失效**/
    @TableField(exist = false)
    private String betweenLeft;
    /**between and 查询的右边，防止索引失效**/
    @TableField(exist = false)
    private String betweenRight;

    public int getTableIndex() {
        int tableIndex = AccountFlow.getTableNoByTenMold(custNo);
        return tableIndex;
    }

    /**
     * 雪花id
     */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 客户号
     */
    @Excel(name = "客户号")
    private String custNo;
    /**
     * 费用类型查看枚举类EnumFeeType
     */
    @Excel(name = "费用类型查看枚举类 EnumFeeType")
    private String feeType;
    /**
     * 金额
     */
    @Excel(name = "金额")
    private BigDecimal amt;
    /**
     * 关联流水号
     */
    @Excel(name = "关联流水号")
    private String relativeSerialNo;
    /**
     * 三方流水号
     */
    @Excel(name = "三方流水号")
    private String reference;
    /**
     * 交易渠道
     */
    @Excel(name = "交易渠道")
    private String transferChannel;
    /**
     * 放款时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "放款时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date loanTime;
    /**
     * 交易时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "交易时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date transferTime;
    /**
     * 冲账时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "冲账时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date offsetTime;
    /**
     * 数据来源：表名
     */
    @Excel(name = "数据来源：表名")
    private String dataSource;
    /**
     * $column.columnComment
     */
    @Excel(name = "数据来源：表名")
    private String remark;
    /**
     * 状态：0失败1正常
     */
    @Excel(name = "状态：0失败1正常")
    private String state;
    /**
     * $column.columnComment
     */
    @Excel(name = "状态：0失败1正常")
    private String createBy;
    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "状态：0失败1正常", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createTime;
    /**
     * $column.columnComment
     */
    @Excel(name = "状态：0失败1正常")
    private String updateBy;
    /**
     * $column.columnComment
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "状态：0失败1正常", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updateTime;

    /**
     * 获取UserId hashcode % 10 取模
     * @param custNo
     * @return
     */
    public static int getTableNoByTenMold(String custNo){
        return Math.abs(custNo.hashCode() % 10);
    }

}